Week 2 - Blink Using OS
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Application Group

Data Structures

struct  led_blink_s
 

Macros

#define BLINK_TASK_STACK_SIZE   (OS_TASK_IDLE_STK_SIZE+0)
 
#define YELLOW_FREQ   (2 * MILLI_HZ_PER_HZ)
 
#define BLUE_RED_FREQ   (1 * MILLI_HZ_PER_HZ)
 
#define RED_START_DELAY   ((BLUE_RED_FREQ * OS_TICKS_PER_SEC) / (2 * MILLI_HZ_PER_HZ))
 

Typedefs

typedef enum LED_POS_ENUM led_t
 
typedef struct led_blink_s led_data_t
 

Enumerations

enum  LED_POS_ENUM { RED_LED, GREEN_LED, BLUE_LED, YELLOW_LED }
 

Functions

void blink_task (void *ptr)
 
void start_blinking (void)
 
int main (void)
 

Variables

static led_data_t blue_config
 
static led_data_t red_config
 
static led_data_t yellow_config
 
static OS_STK blue_task_stk [BLINK_TASK_STACK_SIZE]
 
static OS_STK red_task_stk [BLINK_TASK_STACK_SIZE]
 
static OS_STK yellow_task_stk [BLINK_TASK_STACK_SIZE]
 

Detailed Description

Application which blinks the color LED alternating Red/Blue at 1 Hz and blinks the Yellow LED at 2 Hz.

Macro Definition Documentation

#define BLINK_TASK_STACK_SIZE   (OS_TASK_IDLE_STK_SIZE+0)

Stack size in stk_size elements

Definition at line 25 of file blink_task.c.

#define BLUE_RED_FREQ   (1 * MILLI_HZ_PER_HZ)

Blue/Red LED blinks at 1 Hz

Definition at line 34 of file blink_task.c.

#define RED_START_DELAY   ((BLUE_RED_FREQ * OS_TICKS_PER_SEC) / (2 * MILLI_HZ_PER_HZ))

To get the Red LED to alternate with the Blue LED we delay its start until halfway through the Blue/Red blink cycle.

Definition at line 38 of file blink_task.c.

#define YELLOW_FREQ   (2 * MILLI_HZ_PER_HZ)

Yellow LED blinks at 2 Hz

Definition at line 33 of file blink_task.c.

Typedef Documentation

Structure which defines to blink_task() the LED to blink and the frequency to blink it at. Based on led_blink_s

Enumerated type that allows generic selection of LEDs on the Launchpad or Boost board by LED color. See LED_POS_ENUM for more information.

Enumeration Type Documentation

Enumerates the available LEDs.

Enumerator
RED_LED 

Red LED of the tri-color LED on the LaunchPad board

GREEN_LED 

Green LED of the tri-color LED on the LaunchPad board

BLUE_LED 

Blue LED of the tri-color LED on the LaunchPad board

YELLOW_LED 

Yellow LED on the Booster Pack board

Definition at line 68 of file blink.h.

Function Documentation

void blink_task ( void *  parms)

Task to blink an LED at a given rate param parms is expected to point to a structure of type led_data_t which contains the parameters used by the task. This function assumes that the parameters are in a static structure.

Returns
void
Note
The task is suspended permanently if it cannot figure out which LED it is controlling.
Parameters
parmsPointer to a structure of led_data_t which contains the parameters used by the task. This function assumes that the parameters are in a static structure

Definition at line 95 of file blink_task.c.

int main ( void  )

Main program entry point. Responsible for initialization of the hardware and the operating system. Also responsible fore setting up and starting initial tasks.

Returns
int This function should never return.

Definition at line 35 of file startup.c.

Here is the call graph for this function:

void start_blinking ( void  )

Function which starts the blink tasks

Returns
void
Note
If there are problems starting a task, this function hangs in a tight loop after detecting the error.

Definition at line 164 of file blink_task.c.

Here is the call graph for this function:

Variable Documentation

blue_config
static
Initial value:
=
{
BLUE_PRIO, BLUE_LED, 0, BLUE_RED_FREQ
}
Definition: blink.h:72
#define BLUE_RED_FREQ
Definition: blink_task.c:34

led_data_t structure defining how the blue led will blink.

Definition at line 53 of file blink_task.c.

blue_task_stk
static

Kernel stack for the blue led instance of blink_task.

Definition at line 81 of file blink_task.c.

red_config
static
Initial value:
=
{
}
Definition: blink.h:70
#define BLUE_RED_FREQ
Definition: blink_task.c:34
#define RED_START_DELAY
Definition: blink_task.c:38

led_data_t structure defining how the red led will blink.

Definition at line 58 of file blink_task.c.

red_task_stk
static

Kernel stack for the red counter point led instance of blink_task.

Definition at line 82 of file blink_task.c.

yellow_config
static
Initial value:
=
{
YELLOW_PRIO, YELLOW_LED, 0, YELLOW_FREQ
}
#define YELLOW_FREQ
Definition: blink_task.c:33

led_data_t structure defining how the yellow led will blink.

Definition at line 63 of file blink_task.c.

yellow_task_stk
static

Kernel stack for the yellow led instance of blink_task.

Definition at line 83 of file blink_task.c.